#ifndef DIRFILESYSTEM_H
#define DIRFILESYSTEM_H

#include <stdio.h>

#include "fs.h"
#include "metafs.h"

typedef struct
{
    FILE *entries[MAX_ENTRIES]; /* TODO: STATIC */
    u32 handles[MAX_ENTRIES]; /* TODO: STATIC */
    u32 nument;
    char *basePath;
} DirFileSystem;
 
void dfs_init(DirFileSystem *dfs);
void dfs_setBasePath(DirFileSystem *dfs, const char *path);
void dfs_free(System *sys);
char *dfs_getRealPath(System *sys, const char *localpath);
void dfs_freeRealPath(char *path);
FileInfo dfs_getFileInfo(System *sys, const char *filename);
s32 dfs_openFile(System *sys, const char *filename, FileAccess access);
size_t dfs_readFile(System *sys, u32 handle, char *pointer, u32 size);
size_t dfs_readFileToAddr(System *sys, u32 handle, u32 addr, u32 size);
void dfs_closeFile(System *sys, u32 handle);
s32 dfs_ownsHandle(System *sys, u32 handle);
s32 dfs_seekFile(System *sys, u32 handle, s32 position, FileMove type);
u32 dfs_getDirListing(System *fsc, const char *path, FileInfo **listing);
void dfs_freeDirListing(FileInfo *listing);
s32 dfs_writeFile(System *sys, u32 handle, u8 *pointer, u32 size);
s32 dfs_writeFileFromAddr(System *sys, u32 handle, u32 addr, u32 size);
s8 dfs_mkdir(System *sys, const char *dir, s32 mode);

#endif

